import { Component, OnInit,AfterViewInit } from '@angular/core';
import { Service } from '../../server/server';
import { ActivatedRoute, Params, Router } from '@angular/router';
declare var $:any;

@Component({
  selector: 'app-indent-button',
  templateUrl: './indent-button.component.html',
})

export class IndentButtonComponent implements OnInit {

  constructor(private server:Service,private activatedRoute: ActivatedRoute,public router: Router) { }

  ngOnInit() {
    
    this.isActive = this.server.isActive;
    
    this.activatedRoute.url.subscribe((p: Params) => {
      if(this.server.isActive == false){
          this.isActive = false;	
          this.indent();
      }
    });
  }

  ngDoCheck(){
    this.isActive = this.server.isActive;
  }


  public isActive;
  indent(){
    this.isActive = !this.isActive;	
    this.server.isActive=this.isActive;
    this.server.eventEmit.emit(this.isActive);
    //console.log(this.isActive)
  }

}
